#pragma once

#include "File_def.h"
#include "FileReader.h"

class FixedSizeBinFileReader
{
public:
	FixedSizeBinFileReader();
	virtual ~FixedSizeBinFileReader();

	bool Init(IN stringc& strBinFile, IN u32 binUseMemory, IN u32 readFlag, IN u32 recordSize);
	void Uninit();

	u32 GetRecordNum();
	u32 GetRecordSize();
	bool GetRecordFromIndex(IN u32 index, OUT void* pRecord);

protected:
	virtual _BIN_FILE_RESULT GetRecordFromOffset(INOUT FileReader* pfr, IN u64 offset, OUT void* pRecord);

protected:
	void Clear();

private:
	// parameter
	u32 m_binUseMemory;
	u32 m_readFlag;
	u32 m_recordSize;

	//
	FileReader* m_pBinFile;
	u64 m_binFileSize;

	u32 m_recordNum;

};